import * as actionTypes from "./constance";
import { countriesCodeList, phonePassword } from "@/services/login";

const countriesCode = (res) => ({
  type: actionTypes.COUNTRIESCODELIST,
  countriesCodeInfo: res,
});
const userInfo = (res) => ({
  type: actionTypes.USERINFO,
  userInfo: res,
});

export const countriesCodeListAction = () => {
  return (dispatch) => {
    countriesCodeList().then((res) => {
      dispatch(countriesCode(res));
    });
  };
};
export const userInfoAction = (phone, md5_password) => {
  return (dispatch) => {
    phonePassword(phone, md5_password).then((res) => {
      dispatch(userInfo(res));
    });
  };
};
